import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'
import {setWindowsName} from '@/utils/index'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta:{
      name:'首页'
    }
  },
  {
    path: '/about',
    name: 'About',
    meta:{
      name:'关于我们'
    },
    component: () => import('../views/About.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
router.beforeEach((to,from,next)=>{
  setWindowsName(to.meta.name)
  next()
})
export default router
